package com.example.arithmeticleetcode.leetcode.September;

import java.util.ArrayList;
import java.util.List;

/**
 * @program: arithmetic-leetcode
 * @description:
 * @author: FangZhen
 * @create: 2020-09-03 10:39
 **/
public class Demo04 {

    public static void main(String[] args) {
        System.out.println('A' - 'a');
    }

    public static String makeGood(String s) {
        StringBuilder sb = new StringBuilder(s);
        int len = -1;
        while (len != sb.length()) {
            len = sb.length();
            for (int i = 0; i < sb.length() - 1; i++) {
                if (Math.abs(sb.charAt(i) - sb.charAt(i + 1)) == 'a' - 'A') {
                    sb.delete(i, i + 2);
                    break;
                }
            }
        }
        return sb.toString();
    }
}
